import java.util.Scanner;

public class Narcissus {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int sum = 0;
        for (int i = 100; (i < n) && (i < 1000); i++) {
            sum = 0;
            sum += (i%10) * (i%10) * (i%10);
            sum += (i/10%10) * (i/10%10) * (i/10%10);
            sum += (i/100) * (i/100) * (i/100);
            if(sum == i){
                System.out.println(i);
            }
        }
    }
}
